/*
 * MainSM.c
 *
 *  Created on: Oct 29, 2012
 *      Author: banfield
 */

/*****************************************************
 * Include Statements
 ****************************************************/
#include "MainSM.h"
#include "NestedSM.h"

/*****************************************************
 * Module Level Variables
 ****************************************************/
// Module level variable contains the current state
static MainSMState_t currentState;

/*****************************************************
 * Initialization Function
 ****************************************************/
void InitMainSM(void)
{
	// All initialization connected to this SM goes here
	currentState = WaitingForCar;
}

/*****************************************************
 * Run Function
 ****************************************************/
void RunMainSM(void)
{
	switch(currentState)
	{
		case WaitingForCar:
			currentState = State2;
		break;
		case State2:
		{
			// Call run function for a nested SM
			RunNestedSM();

			// Check for events with if-statements within the SM
			if(1) {
				// Action associated with event
				currentState = State3;
			}
		}
		break;
		case State3:
		{
			// Check for events with if-statements within the SM
			if(1) {
				// Action associated with event
			}
		}
	}
}
